<!--
 * @Author: your name
 * @Date: 2021-10-14 10:09:41
 * @LastEditTime: 2021-10-18 09:29:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \mustache_lk\www\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="container"></div>
    <script src="./xuni/task/bundle.js"></script>
    <script>
        var template = `<h1>我今天开始敲写{{thing}}，好{{mood}}啊！{{a.b.c}}</h1>`;
        var template2 = `<ul>
            这是第二个数据测试：{{name}}
                        {{#students}}
                            <li>姓名是：{{name}}
                                {{#hobbies}}
                                    <ol>
                                        爱好：{{.}}
                                    </ol>
                                {{/hobbies}}    
                            </li>
                        {{/students}}
                    </ul>`

        var template3 = `<ul>
                            {{#list}}
                                <li>{{.}}</li>
                            {{/list}}
                        </ul>`

        var data = {
            thing: 'mustache',
            mood: '开心',
            a: {
                b: {
                    c: '是吧？'
                }
            }
        }
        var data2 = {
            name: '测试2',
            students: [{
                name: 'luokai',
                hobbies: ['吃饭', '睡觉']
            }, {
                name: 'wuhu',
                hobbies: ['吃饭2', '睡觉2']
            }]
        }
        var data3 = {
            list: ['水果', '元素']
        }

        var container = document.getElementById('container')
        container.innerHTML = Mustache_lk.render(template, data)
        container.innerHTML += Mustache_lk.render(template2, data2) 
        container.innerHTML += Mustache_lk.render(template3, data3)
    </script>
</body>

</html>